package UnitTest;

import static org.junit.Assert.*;

import java.util.Calendar;

import junit.framework.Assert;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;


import ControlLayer.SaleCtr;
import ModelLayer.Enum;
import ModelLayer.Customer;
import ModelLayer.Invoice;
import ModelLayer.Product;
import ModelLayer.Sale;

public class SaleCtrTest {
	private Product product;
	private Sale sale;
	private SaleCtr saleCtr;

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
		saleCtr = new SaleCtr();
		
		
	}

	@After
	public void tearDown() throws Exception {
		
		
	}

	@Test
	public void testGetSale() {
		int saleId = saleCtr.insertSale(1, Calendar.getInstance().getTime(), Calendar.getInstance().getTime(), 100, "NotDelivered", 1);
		Assert.assertEquals(saleId, saleCtr.getSale(saleId).getSaleId());
		saleCtr.deleteSale(saleId);
		
		
	}

	@Test
	public void testInsertSale() {
		int saleId = saleCtr.insertSale(1, Calendar.getInstance().getTime(), Calendar.getInstance().getTime(), 100, "NotDelivered", 1);
		Assert.assertEquals(saleId, saleCtr.getSale(saleId).getSaleId());
		saleCtr.deleteSale(saleId);
		
	}

	@Test
	public void testDeleteSale() {
		int saleId = saleCtr.insertSale(1, Calendar.getInstance().getTime(), Calendar.getInstance().getTime(), 100, "NotDelivered", 1);
		Assert.assertEquals(1, saleCtr.deleteSale(saleId));
		
	}

	@Test
	public void testInsertSaleLine() {
//		int saleId = 100;
//		int productId = 2;
//		saleCtr.insertSaleLine(100, 2, 1);
//		Assert.assertEquals(2, saleCtr.get);
//		saleCtr.deleteSaleLinesForSale(100);
		
	}

	

}
